package exception;

public class ThrowDemo {
    public static void main(String[] args) {
        Person p = new Person();
//        p.setAge(20);
//        p.setAge(100);//满足语法,但是不满足业务条件
        try {
            p.setAge(100);
        }catch (IllegalAgeException e){
            throw new RuntimeException(e);
        }
        System.out.println("此人年龄:" + p.getAge());
    }
}
